import request from '@/utils/request'

export function getTypeList() {
  return request({
    url: '/articleType/getArticleTypeList',
    method: 'get'
  })
}

export function getArticle(data) {
  return request({
    url: '/article/getArticle',
    method: 'post',
	data
  })
}

export function getArticleTypeList(data) {
  return request({
    url: '/article/getArticleByType',
    method: 'post',
	data
  })
}

export function queryArticle(data) {
  return request({
    url: '/article/search',
    method: 'post',
	data
  })
}

// 获取文章信息
export function getArticleInfoById(articleId) {
  return request({
    url: '/article/getArticleInfoById',
    method: 'get',
	params: { articleId }
  })
}

// 点赞
export function like(articleId) {
  return request({
    url: '/article/like',
    method: 'get',
	params: { articleId }
  })
}

// 取消点赞
export function unLike(articleId) {
  return request({
    url: '/article/unLike',
    method: 'get',
	params: { articleId }
  })
}

// 收藏
export function cart(articleId) {
  return request({
    url: '/article/cart',
    method: 'get',
	params: { articleId }
  })
}

// 取消收藏
export function unCart(articleId) {
  return request({
    url: '/article/unCart',
    method: 'get',
	params: { articleId }
  })
}

// 添加文章
export function insertArticle(data) {
  return request({
    url: '/article/insertArticle',
    method: 'post',
	data
  })
}

// 获取历史记录
export function getUserRecordArticle(data) {
  return request({
    url: '/article/getUserRecordArticle',
    method: 'post',
	data
  })
}

// 清除历史记录
export function deletedRecord() {
  return request({
    url: '/article/deletedRecord',
    method: 'get'
  })
}

// 获取用户收藏文章
export function getUserCartArticle(data) {
  return request({
    url: '/article/getUserCartArticle',
    method: 'post',
	data
  })
}

// 获取用户点赞文章
export function getUserLikeArticle(data) {
  return request({
    url: '/article/getUserLikeArticle',
    method: 'post',
	data
  })
}

// 获取文章分类数据
export function getArticleType(data) {
  return request({
    url: '/articleType/getArticleType',
    method: 'post',
	data
  })
}

// 根据id获取文章分类数据详细
export function getArticleTypeById(articleTypeId) {
  return request({
    url: '/articleType/getArticleTypeById',
    method: 'get',
	params: {articleTypeId}
  })
}

// 添加文章分类数据
export function insertArticleType(data) {
  return request({
    url: '/articleType/insertArticleType',
    method: 'post',
	data
  })
}

// 修改文章分类数据
export function alterArticleTypeById(data) {
  return request({
    url: '/articleType/alterArticleTypeById',
    method: 'post',
	data
  })
}